﻿using RotovapPlatform.Domain.Equipment.Interfaces.Base;

namespace RotovapPlatform.Domain.Equipment.Interfaces.Communication;

/// <summary>
/// EtherCAT通信管理接口
/// </summary>
public interface IEtherCATManager : IConnectable
{
	/// 控制卡ID
	short CardId { get; }

	//从站数量
	short SlaveNum { get; set; }

	//轴数量
	short AxisNum { get; set; }

	//IO从站数量
	short IoSlaveNum { get; set; }

	//DI数量
	short DiNum { get; set; }

	//DO数量
	short DoNum { get; set; }

	//AI数量
	short AiNum { get; set; }

	//AO数量
	short AoNum { get; set; }

	//清除轴错误状态和驱动器报警
	Task<bool> ClearAxisError();

	//清除轴卡急停状态
	Task<bool> ClearAxisEmergencyStop();


	/// <summary>
	/// 获取所有轴状态
	/// </summary>
	/// <param name="axisId">轴ID</param>
	Task<bool> GetAllAxisStatusAsync();

	/// <summary>
	/// 获取轴错误码
	/// </summary>
	/// <param name="axisId">轴ID</param>
	Task<int> GetAxisErrorCodeAsync();

	/// <summary>
	/// 获取指定轴的状态值
	/// </summary>
	/// <param name="axisId">轴ID</param>
	/// <returns>状态值，-1表示获取失败</returns>
	int GetAxisStatus(int axisId);

	/// <summary>
	/// 获取指定轴的位置
	/// </summary>
	/// <param name="axisId">轴ID</param>
	/// <returns>位置值，-1表示获取失败</returns>
	int GetAxisPosition(int axisId);

	/// <summary>
	/// 获取指定轴的速度
	/// </summary>
	/// <param name="axisId">轴ID</param>
	/// <returns>速度值，-1表示获取失败</returns>
	double GetAxisVelocity(int axisId);

	/// <summary>
	/// 获取指定轴的扭矩
	/// </summary>
	/// <param name="axisId">轴ID</param>
	/// <returns>扭矩值，-1表示获取失败</returns>
	int GetAxisTorque(int axisId);

	/// <summary>
	/// 获取指定轴的规划位置
	/// </summary>
	/// <param name="axisId">轴ID</param>
	/// <returns>规划位置值，-1表示获取失败</returns>
	double GetAxisPlanPosition(int axisId);

	/// <summary>
	/// 获取指定轴的规划速度
	/// </summary>
	/// <param name="axisId">轴ID</param>
	/// <returns>规划速度值，-1表示获取失败</returns>
	double GetAxisPlanVelocity(int axisId);


}